<!DOCTYPE html>
<html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px">
<head>
    <title></title>
    <meta charset="utf-8">
    <meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">    <link rel="stylesheet" href="passenger/css/project/ui-res-v3.css">
    <link rel="stylesheet" href="passenger/css/project/ui-color-v3.css">
    <link rel="stylesheet" href="passenger/css/project/ui-btn-v3.css">
    <link rel="stylesheet" href="passenger/css/ui-box.css?v=202022">
    <link rel="stylesheet" href="passenger/css/ui-base.css?v=202022">
    <link rel="stylesheet" href="passenger/css/ui-position.css?v=202022">
    <link rel="stylesheet" href="passenger/css/ui-img.css?v=202022">
    <link rel="stylesheet" href="passenger/css/ui-color.css?v=202022">
    <link rel="stylesheet" href="passenger/css/ui-input.css?v=202022">
    <link rel="stylesheet" href="passenger/css/iBox.css?v=202022">
	<style>
		.res-searchtop{
			background-image:url(css/images/search-top.png);
		}
		.w15{
			width: 12.5%;
			padding: .3em 0em;
			font-size:.9em ;
			text-align: center;
		}
		.w20{
			width: 25%;
			padding: .7em 0em;
			font-size:.9em ;
			text-align: center;
		}
		.w30{
			width: 35%;
			padding: .7em 0em;
			font-size:.9em ;
			text-align: center;
		}
		input[type=checkbox],
		input[type=radio]{
		-webkit-appearance: none;
		appearance: none;
		width: 3em;
		height:3em;
		margin: 0;
		cursor: pointer;
		vertical-align: bottom;
		background: url('css/images/no.png')no-repeat;
		background-size: 3em;
		-webkit-border-radius: 1px;
		-moz-border-radius: 1px;
		border-radius: 1px;
		-webkit-box-sizing: border-box;
		-moz-box-sizing: border-box;
		box-sizing: border-box;
		position: relative;
		border:none
		}
		
		input[type=checkbox]:active,
		input[type=radio]:active {
		border-color: #c6c6c6;
		}
		input[type=checkbox]:checked,
		input[type=radio]:checked {
		/*background: #fff;*/
		}
		input[type=checkbox]:checked::after {
		content: close-quote;
		background: url('css/images/cheked.png')no-repeat;
		background-size: 3em;
		display: block;
		width:3em;
		height: 3em;
		position: absolute;
		}
		input[type=checkbox]:focus {
		outline: none;
		border-color:#4d90fe;
		}
		.rdi{
			border-right:solid 2px #ffffff
		}
		.rdi1{
			color:#7C9FE3;border-bottom:solid 3px #7C9FE3
		}
	</style>
</head>
<body class="um-vp c-wh ub-ver" ontouchstart>
	<div class="ub uba ub-ac ub-pc ulev-1" style="background:#7C9FE3">
	    <div class="ub-f1 uinn ">
	    	<div class="t-bla ub uc-a4 ub-ac c-wh uinput ">	
			   <div class="res-searchtop btn_wh1 ub-img "></div>	
			   <div class="ub-f1 uinn"><input placeholder="输入姓名搜索" id="serchText" type="text" style="background:none;"> </div> 
			</div>
	    </div>
	    <div class="ubr t-wh uinn" id="serch">搜索</div>
	    <div class="uinn t-wh" id="del">清除</div>
	</div>
	<!--单选框开始-->
	<div class="divTable ub uc-a1 t-bla c-gra uba b-wh tx-c ulev-1" style="margin:auto">
		<div class="uinn5 ub-f1 rdi rdi1">普通</div>
		<div class="uinn5 ub-f1 rdi ub ub-pc ub-ac">VIP</div>
		<div class="uinn5 ub-f1 rdi ub ub-pc ub-ac">VIP*</div>
		<div class="uinn5 ub-f1 rdi ub ub-pc ub-ac">VVIP</div>
		<div class="uinn5 ub-f1 rdi ub ub-pc ub-ac">OTHER</div>
	</div>
	<!--块容器开始-->
	<div class="c-wh  ub ub-ac ub-pc uinn t-gra">已选择旅客人数<font color="red" id="num" size="7">0</font>人</div>
	<div class="ub c-gra t-dgra ">
	    <div class=" w20 rdi ub ub-pc ub-ac">会员级别</div>
	    <div class=" w20 rdi ub ub-pc ub-ac" >姓名</div>
	    <div class=" w30 rdi ub ub-pc ub-ac">联系方式</div>
	    <div class=" uc-r1 w15 ub ub-pc ub-ac">
	       <div class="i-check">  
		       <input type="checkbox" name="partyID" id="checkbox" onclick="checkAll()" value=''/>  
		   </div> 
		</div>
	</div>
	<div class="c-wh ulev-1" id="divTemp" style="margin-bottom:4em">
	</div>
	<div style="height:1em">
	</div>
	<!--按钮开始-->
	<div ontouchstart="zy_touch('btn-act')" style="position:fixed;bottom:0em;width:100%;background-color:#1D98F5" class="btn uba uinn5 t-wh tx-c"  onclick="returnBox()">确定</div>
	<!--按钮结束-->

	<!--块容器结束-->
</body>
 <script src="js/zy_control.js?v=202022"></script>
<script src="js/zy_click.js?v=202022"></script>
<script src="js/zy_event.js?v=202022"></script>
<script src="js/jquery.js?v=202022"></script>
<script src="js/iBox.js?v=202022"></script>
<script src="passenger/js/common.js"></script>
<script src="passenger/js/flyList.js?v=202022"></script>
<script src="passenger/js/dateBund.js"></script>
<script src="passenger/js/flySearch.js"></script>
<script>
zy_init();
window.uexOnload=function(type){
	if(!type){
//		uexWindow.setBounce("1");
//		uexWindow.showBounceView("0", "rgba(255,255,255,0)", "0");
//        uexWindow.showBounceView("1", "rgba(255,255,255,0)", "0");
	}
	loadUserInfo('');
}
  function loadUserInfo(viplevel){
  	$.iBoxWait();
	var dataObj = JSON.parse(getStorage("data"));
	var pageJson = JSON.parse(getStorage("pageJson"));
  	var strFlightnumber=pageJson.carrier+pageJson.flightNo;
	var strFlightDate=dataObj.time;
	var strDepartureAirport=pageJson.deptairPort;
	var strArriveAirport=pageJson.arrairPort;
    var url = 'http://172.31.64.34:8011/11206260/public/DFECIF/getPassengerinfo?strFlightnumber='+strFlightnumber+'&strFlightDate='+strFlightDate+'&strDepartureAirport='+strDepartureAirport+'&strArriveAirport='+strArriveAirport+'&viplevel='+viplevel+'';
    $.ajax({
        type: "get",
        contentType: 'application/json',
        dataType: "json",
        url: url,
        cache: false,
        success: function(data){
//				console.log(JSON.stringify(data));
				$("#num").html(0);
				$('#checkbox').attr("checked", false);
                if (data.status == 0) {
					$("#divTemp").html("");
					$.iBoxHide();
					if (data.data == '没有找到相关信息') {
						$("#divTemp").html('<div  class="btn uinn5  uc-a1 umar-a tx-c" style="border:dashed 3px #EEEEEE">没有找到相关信息</div>');
						localStorage.setItem("jsondata", '[]');
						return false;
					}
					else {
						var json = data.data;
						localStorage.setItem("jsondata", JSON.stringify(json));
						for (var i = 0; i < json.length; i++) {
							if (json[i].phoneNumber != null && json[i].phoneNumber.length == 11) {
								var viplevel = json[i].viplevel;
								if (viplevel == null) {
									viplevel = "普通"
								}
								$("#divTemp").append('<div class="ub ubb t-gra" >\
							<div class="w20 ub ub-pc ub-ac">' + viplevel + '</div>\
						    <div class="w20 ub ub-pc ub-ac">' +
								json[i].fullName +
								'</div>\
						    <div class="w30 ub ub-pc ub-ac">' +
								json[i].phoneNumber +
								'</div>\
							<div class="ub ub-pc ub-ac w15 umar-l">\
							<div class="i-check"> \
		       				<input type="checkbox"  name="partyID" phone=' +
								json[i].phoneNumber +
								' names=' +
								json[i].fullName +
								' value=' +
								json[i].partyID +
								' onclick="pushBox()"/></div></div></div>');
							}
						}
					}
                }else{
					 $.iBoxMsg("请求失败");
				}
        },
        error: function(data){
             $.iBoxMsg("网络异常");
        }
    });
};

    //多选按钮的全选与反选
	function checkAll() {
		var test = document.getElementById("checkbox").checked;
		var ch = $('input[type="checkbox"][name="partyID"]');
		$.each(ch, function(i, n) {
		if(test==true){
			n.checked = true;
			$("#num").html(ch.length-1);
		}else{
			n.checked = false;
			$("#num").html(0);
		}
		})
	};
	
	/**
	 * 选择人数
	 */
	function pushBox(){
		var c=0;
		var ch = $('input[type="checkbox"][name="partyID"]');
		$.each(ch, function(i, n) {
			if (n.checked) {
				c++;
			} 
		})
		var test = document.getElementById("checkbox").checked;
		if (test == true) {
			c--;
		}
		$("#num").html(c);
	}
	
	/**
	 * 提交
	 */
	function returnBox(){
		var num = $("#num").html();
		if(num==0){
			 $.iBoxMsg("请至少选择一个联系人");
		}else{
			var phones=[];
			var names='';
			var ch = $('input[type="checkbox"][name="partyID"]');
			$.each(ch, function(i, n) {
				if (n.checked) {
					var json ={"phone":$(this).attr("phone"),"names":$(this).attr("names")};
					phones.push(json);
					names+=$(this).attr("names")+','
				} 
			}) 
			localStorage.setItem("phones",JSON.stringify(phones));
			localStorage.setItem("names",names.substr(0,names.length-1));
			uexWindow.evaluateScript("passenger", 0, "backPage();");
			uexWindow.evaluatePopoverScript("detailed", "content", "setPhone();");
		}
	}
	
	/**
	 * 选项卡
	 */
	$(".divTable").children().click(function(){
		$(this).addClass("rdi1");
		$(this).siblings().removeClass("rdi1");
		var val = $(this).html();
		if(val=="普通"){
			val="";
		}
		loadUserInfo(val);
	})
	
	/**
	 * 查询
	 */
	$("#serch").click(function(){
		$("#divTemp").html("");
		var serchText = $("#serchText").val().trim();
		var json = JSON.parse(localStorage.getItem("jsondata"));
		if (json.length > 0) {
			for (var i = 0; i < json.length; i++) {
				var fullName = json[i].fullName;
				if(!fullName) break;
				//返回大于等于0的整数值，若不包含"Text"则返回"-1。
				if (fullName.indexOf(serchText) >= 0) {
					if (json[i].phoneNumber != null && json[i].phoneNumber.length == 11) {
						var viplevel = json[i].viplevel;
						if (viplevel == null) {
							viplevel = "普通"
						}
						$("#divTemp").append('<div class="ub ubb t-gra" >\
				<div class="w20 ub ub-pc ub-ac ">' + viplevel + '</div>\
			    <div class="w20 ub ub-pc ub-ac">' +
						fullName +
						'</div>\
			    <div class="w30 ub ub-pc ub-ac">' +
						json[i].phoneNumber +
						'</div>\
				<div class="ub w15 umar-l ub-pc ub-ac">\
				<div class="i-check"> \
   				<input type="checkbox"  name="partyID"  value=' +
						json[i].partyID +
						' onclick="pushBox()"/></div></div></div>');
					}
				}
			}
		}else{
			$("#divTemp").html('<div  class="btn uinn5  uc-a1 umar-a tx-c" style="border:dashed 3px #EEEEEE">没有找到相关信息</div>');
		}
	})
	
	$("#del").click(function(){
		$("#serchText").val("");
		});
</script>
</html>
